from typing import List
class Solution:
    def kLengthApart(self, nums: List[int], k: int) -> bool:
        last = -1
        for i, n in enumerate(nums):
            if n == 1:
                if last != -1 and i - last <= k:
                    return False
                last = i
        return True